<?php if(isset($this->items)){?>
	<?php 
	global $jbconfig;
	if( ! isset ($formName) )
		$formName = "adminForm";
	?>
	
	<script type="text/javascript">
		var select_text_resume = '<?php echo JText::_('resumes selected')?>';
	</script>
	
	<!-- BOX ACTION TOP -->
	<?php if (count($this->items)>0) {?>
	<div id="ja-box-action-top">
	
    <?php if(!isset($module)){?>
    <?php $filter_order = JRequest::getVar('filter_order', $jbconfig['posts']->get('filter_order', 'title')); ?>
	<?php $filter_order_dir = JRequest::getVar('filter_order_Dir', $jbconfig['posts']->get('filter_order_Dir', 'desc')); ?>
    <div class="ja-sortlist clearfix">
		<span><label for="filter_order_2"><?php echo JText::_('Sort By')?>:</label></span>
		<select class="sortby" onchange="document.adminForm.method='get';$('task').value=''; $('filter_order').value=this.value; document.adminForm.submit();" name="filter_order_2" id="filter_order_2">
		 	<!--<option value="a.is_hotjob" <?php if($filter_order=='a.is_hotjob'){?>selected="selected"<?php }?>><?php echo JText::_('Featured Job')?></option>-->
			<option value="a.created_date" <?php if($filter_order=='a.created_date'){?>selected="selected"<?php }?>><?php echo JText::_('Date')?></option>
			<option value="a.location_id" <?php if($filter_order=='a.location_id'){?>selected="selected"<?php }?>><?php echo JText::_('Location')?></option>
			<!--<option value="a.title" <?php if($filter_order=='a.title'){?>selected="selected"<?php }?>><?php echo JText::_('Job Title')?></option>-->
			<option value="a.title" <?php if($filter_order=='a.title'){?>selected="selected"<?php }?>><?php echo JText::_(' Resume Title')?></option>
		</select>
		
		<select class="sortby" onchange="document.adminForm.method='get';$('filter_order_Dir').value=this.value; document.adminForm.submit();" name="filter_order_Dir_2" id="filter_order_Dir_2">
			<option value="asc" <?php if($filter_order_dir=='asc'){?>selected="selected"<?php }?>><?php echo JText::_('ASC')?></option>
			<option value="desc" <?php if($filter_order_dir=='desc'){?>selected="selected"<?php }?>><?php echo JText::_('DESC')?></option>
		</select>
	</div>
	<?php }?>
	
    <input type="checkbox" name="toggle" value="" onclick="checkAlls(document.<?php echo $formName;?>, <?php echo count($this->items); ?>); updateselectallResumes('<?php echo $formName;?>', this, <?php echo count($this->items); ?>);" class="ja-selectall" />
    <input type="text" readonly="readonly" value="0 <?php echo JText::_('resumes selected')?>" id="selectedJobs<?php echo $formName;?>" name="selectedJobs<?php echo $formName;?>" class="ja-job-selected-number" />
    
		<a href="javascript:submitbutton('multi_view','<?php echo count($this->items); ?>')" class="button">
			<span style="vertical-align: top !important;"><?php echo JText::_('View'); ?></span>
		</a>      
	<?php if (getCurrentUserType() == JBEMPLOYER_USER) { ?>
		<a href="javascript:submitbutton('multi_starred','<?php echo count($this->items); ?>')" class="button">
			<span style="vertical-align: top !important;"><?php if (JRequest::getVar('layout')!='jaemployerlist') echo JText::_('Favorite'); else echo JText::_('Remove favorite'); ?></span>
		</a>            
	<?php } ?>
	</div>
	<?php } ?>
	<!-- BOX ACTION TOP -->
	
	<!-- JA JOBLIST -->
	<div id="ja-joblist">
		<ol id="ja-searchjoblist">
			
			<?php
		  	$items = $this->items;
		  	$k = 0;
		  	$orderNo = 0;
		  	$currentTable = '';
		  	$max_length = $jbconfig['posts']->get('posts_description_chars')? $jbconfig['posts']->get('posts_description_chars'):150;		  
		  	for($ii = 0, $nn = count($this->fieldlist); $ii < $nn; $ii++ ){
		  		$field = $this->fieldlist[$ii];
                $field_name = $field->field_name;                          
		  	}
		  
		  	for($i = 0, $n = count($this->items); $i < $n; $i++, $orderNo++){
		   		$item = $items[$i];
		   		
		   		$class = '';
				if(is_array($item->category_tmp)) $cats = implode(',', $item->category_tmp);
		   		else $cats = $item->category_tmp;
				$cat_names = getCategories($cats);
				$cats = explode(',',$cat_names);

				if(is_array($item->location_id_tmp)) $locations = implode(',', $item->location_id_tmp);
		   		else $locations = $item->location_id_tmp;
		   		$location_names = getLocation($locations);
		   		$locations = explode(',',$location_names);
		   		?>   		
				<li onclick="updateselectedResume($('cb<?php echo $i?>'))" id="li_<?php echo $item->id; ?>" class="<?php echo $class?>  row<?php echo ($i%2); ?> <?php if ($i+1==$n): echo 'last'; endif;?>" onmouseover="$(this).addClass('hover')" onmouseout="$(this).removeClass('hover')">
					<div class="inner">
					
					<span class="ja-job-item-checkbox">
						<input title="<?php echo JText::_('Click here to view more resumes')?>" id="cb<?php echo $i?><?php echo $formName;?>" type="checkbox" onclick="isCheckedJob(document.<?php echo $formName;?>, this.checked); updateselectedResume('<?php echo $formName;?>', this)" value="<?php echo $item->id; ?>" name="cid[]"/>
					</span>
									 
					<?php if($jbconfig['posts']->get('postsshow_days_elapsed', 1)) { ?>
					<span class="datetime">(<?php echo generatTimeStamp(strtotime($item->created_date))?>)</span>
					<?php } else { ?>
					<span class="datetime">(<?php echo generateDate($item->created_date)?>)</span>
					<?php } ?>
					
					 <?php if(time()-strtotime($item->created_date)<=24*60*60) { ?>
						<span class="ja-new-job">(<?php echo JText::_('New')?>)</span>
					<?php }?>
	       		
	       			<span class="ja-row-number">
	       			<?php if (isset($this->pagination)) { ?>
	       				<?php echo $i+1+$this->pagination->limitstart; ?>
	       			<?php }else{?>
	       				<?php echo $i+1; ?>
	       			<?php }?>
	       			</span>
					
					<div class="ja-job-details">
						
						<!-- JOB TITLE -->
						<h3 class="ja-job-title">
							<?php 
								$temp = JFactory::getUser($item->user_id_tmp);
								if (is_object($temp))
									$username = $temp->username;
								else 
									$username = '';
								$username = str_replace('.', '()', $username);
							?>
							<a href="<?php echo JRoute::_( 'index.php?option='. JBCOMNAME .'&view=jaresumes&layout=jaview&cid[]='.$username.'&Itemid='.$this->Itemid); ?>"  class="<?php echo $class;?>">
								<?php echo $item->title; ?>
							</a>																						
	         			</h3>
	         			<!-- //JOB TITLE -->
	              	
		              	<?php 
							//Get Logo size
							if (!$item->image)
							{
								$item->image = JURI::base () . 'components/com_jajobboard/images/no-image.gif';
							}
							
							$logo_size = jaGetImageSize($item->image);
							$logo_width = $logo_size['width'];
							$logo_height = $logo_size['height'];
							
						?> 	                       	
			            <div class="ja-job-description <?php if($item->image) echo 'enhancedAd';?> clearfix">
			            <a href="<?php echo JRoute::_( 'index.php?option='. JBCOMNAME .'&view=jaresumes&layout=jaview&cid[]='.$item->id.'&Itemid='.$this->Itemid); ?>"  class="<?php echo $class;?>">
			            	<img src="<?php echo $item->image?>" alt="<?php echo $item->title?>" class="logo" align="left" width="<?php echo $logo_width?>" height="<?php echo $logo_height?>"/>
			            </a>
			            <!--<span class="ja-companyname">
			            <a href="<?php echo JRoute::_( 'index.php?option='. JBCOMNAME .'&view=jaresumes&layout=jaview&cid[]='.$item->id.'&Itemid='.$this->Itemid); ?>"  class="<?php echo $class;?>">
			            	<?php echo $item->title?>
			            </a>
			            </span>
							--><?php 
							$item->description = htmlspecialchars_decode($item->description);
							echo SmartTrim::trim($item->description,0,$max_length) 
							?>
							
			         			<div class="ja-job-meta clearfix">
									<span class="ja-job-category">
				            			<?php if($cats) { ?>
					            			<strong><?php echo JText::_('Category')?>:</strong>
											<?php foreach ($cats as $cat) { ?>
					            				<a href="<?php echo JRoute::_('index.php?option=com_jajobboard&view=jaresumes&layout=jalist&category='.$cat)?>" title="<?php echo $cat?>"><?php echo $cat?></a> 
					            			<?php } ?>				            
					            		<?php } ?>
			          				</span>
			          
			          				<span class="ja-job-location">
										<strong><?php echo JText::_('Location')?>: </strong>							
										<?php foreach ($locations as $location) { ?>
				            				<a href="<?php echo JRoute::_('index.php?option=com_jajobboard&view=jaresumes&layout=jalist&location_id='.$location)?>" title="<?php echo $cat?>"><?php echo $location?></a> 
				            			<?php } ?>	
									</span>
							</div>
						</div>
		                    
	          		</div>
        	</div>           
        </li>
		            
		  <?php } ?>
	 	</ol>
	 </div>
	 <!-- //JA JOBLIST -->
	<?php if (count($this->items)>0) {?> 
	<div id="ja-box-action-bot" class="clearfix">
			
	  <input type="text" readonly="readonly" value="0 <?php echo JText::_('resumes selected')?>" id="selectedJobs2<?php echo $formName;?>" name="selectedJobs2<?php echo $formName;?>" class="ja-job-selected-number" />	
	  <a href="javascript:submitbutton('multi_view','<?php echo count($this->items); ?>')" class="button">
			<span style="vertical-align: top !important;"><?php echo JText::_('View'); ?></span>
		</a>      
		<?php if (getCurrentUserType() == JBEMPLOYER_USER) { ?>
		<a href="javascript:submitbutton('multi_starred','<?php echo count($this->items); ?>')" class="button">
			<span style="vertical-align: top !important;"><?php if (JRequest::getVar('layout')!='jaemployerlist') echo JText::_('Favorite'); else echo JText::_('Remove favorite'); ?></span>
		</a>  
		<?php } ?>
	</div>
	 
	 
	<?php if(!JRequest::getVar('ajax') && isset($this->pagination)){?>
		<div class="jobs-pagination clearfix">			
			<?php echo $this->pagination->getPagesLinks(); ?>
		</div>
	<?php } elseif(isset($this->pagination)) {?>
		<div class="jobs-pagination clearfix">
			<div class="limit">
				<label for="limit"><?php echo JText::_("Display num")?></label>
				<?php echo $this->getListLimit(JRequest::getInt('limit', $jbconfig['posts']->get('display_num'))); ?>
			</div>
			
			<?php echo $this->pagination->getPagesLinks(); ?>
		</div>
	<?php } ?>
	
	
<?php } } ?>   



